package comcksys.authserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import comcksys.authserver.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author: yxzhang23
 * @time: 2021/4/8
 */
public interface RoleMapper extends BaseMapper<Role> {

    /**
     * 通过用户id获取用户的权限信息
     * @param uId   用户id
     * @return      权限信息
     */
    @Select("select * from role where id in (select role_id from user_role where user_id = #{uId})")
    List<Role> getRoleListByUserId(@Param("uId") Long uId);

}
